package com.qy139.util;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author yuhaochen
 * @Date 2021/11/20
 */
@Api("返回结果")
@Data   // toString  get Set
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    /**
     * 状态码
     */
    @ApiModelProperty("状态码")
    private Integer code = 0;
    /**
     * 消息
     */
    @ApiModelProperty("消息")
    private String msg = "操作成功";
    /**
     * 数据  任意
     */
    @ApiModelProperty("数据  任意")
    private T data;

    public Result(T t){
        this.code=0;
        this.msg="操作成功";
        this.data=t;
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
